package com.facebook.presto.tdengine;

import com.facebook.presto.common.type.Type;
import com.facebook.presto.spi.ColumnHandle;
import com.facebook.presto.spi.ColumnMetadata;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;


public class TdEngineColumnHandle implements ColumnHandle {

    private String columnName;
    private Type columnType;
    private int ordinalPosition;
    private String connectorId;

    @JsonProperty
    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    @JsonProperty
    public Type getColumnType() {
        return columnType;
    }

    public void setColumnType(Type columnType) {
        this.columnType = columnType;
    }

    @JsonProperty
    public int getOrdinalPosition() {
        return ordinalPosition;
    }

    public void setOrdinalPosition(int ordinalPosition) {
        this.ordinalPosition = ordinalPosition;
    }

    @JsonProperty
    public String getConnectorId() {
        return connectorId;
    }

    public void setConnectorId(String connectorId) {
        this.connectorId = connectorId;
    }

    @JsonCreator
    public TdEngineColumnHandle(@JsonProperty("connectorId") String connectorId,
                                @JsonProperty("columnName") String columnName,
                                @JsonProperty("columnType") Type columnType,
                                @JsonProperty("ordinalPosition") int ordinalPosition) {
        this.ordinalPosition = ordinalPosition;
        this.connectorId = connectorId;
        this.columnType = columnType;
        this.columnName = columnName;
    }

    public ColumnMetadata getColumnMetadata() {
        return new ColumnMetadata(columnName, columnType);
    }
}
